#ifndef FILTERWIDGET_H
#define FILTERWIDGET_H

#include <QWidget>
#include <QMap>
#include <QVariant>
#include "configmanager.h"

class QLineEdit;
class QComboBox;
class QDateEdit;
class QLabel;
class QPushButton;
class QHBoxLayout;
class QVBoxLayout;

class FilterWidget : public QWidget
{
    Q_OBJECT
public:
    explicit FilterWidget(const QVector<FilterConfig> &filters, QWidget *parent = nullptr);

     QMap<QString, QVariant> getFilterValues() const;
    void clearFilters();

signals:
    void filterChanged();

private slots:
    void onFilterValueChanged();
    void onResetFilters();

private:
    QVector<FilterConfig> m_filters;
    QMap<QString, QWidget*> m_filterWidgets;
    QPushButton *m_resetButton;
    QPushButton *m_searchButton;

    QWidget* createFilterControl(const FilterConfig &filter);
    QWidget* createTextFilter(const FilterConfig &filter);
    QWidget* createDateRangeFilter(const FilterConfig &filter);
    QWidget* createComboBoxFilter(const FilterConfig &filter);
};

#endif // FILTERWIDGET_H
